package app

import (
	"shop-api/etc"
	"shop-common/library/variables"
	"shop-common/utils"
)

func setupSettingVars(configure *etc.Configuration) error {
	variables.AppDebug = configure.AppDebug

	if err := utils.StructMapStrict(configure.Mysql, &variables.MysqlSetting); err != nil {
		return err
	}

	if err := utils.StructMapStrict(configure.Redis, &variables.RedisSetting); err != nil {
		return err
	}

	if err := utils.StructMapStrict(configure.Logger, &variables.LoggerSetting); err != nil {
		return err
	}

	return nil
}
